package com.han.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.han.demo.entity.User;
import com.han.demo.mapper.UserMapper;
import com.han.demo.service.PersonService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;

/**
 * @author hanjl
 * @Description TODO
 * @ClassName PersonServiceImpl
 * @createTime 2021/9/3 14:14
 */
@Service
public class PersonServiceImpl extends ServiceImpl<UserMapper, User> implements PersonService {

    @Resource
    private UserMapper userMapper;


    @Override
    public Integer batchSave(List<User> list) {
        User user1 = new User();
        user1.setId(1);
        user1.setName("hnajiael");
        user1.setAge(18);
        user1.setRemark("测试");
        User user2 = new User();
        user2.setId(2);
        user2.setName("飞龙在天");
        user2.setAge(33);
        user2.setRemark("测试");
        User user3 = new User();
        user3.setId(3);
        user3.setName("花花");
        user3.setAge(66);
        user3.setRemark("测试");
        List<User> list1 = new LinkedList<>();
        list1.add(user1);
        list1.add(user2);
        list1.add(user3);
        boolean b = saveBatch(list1);
        System.out.println("结构："+ b);
        return 0;
    }
}
